<template>
	<view>
		<u-button type="error" @tap="goLogin"> 微信一键登录</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			goLogin(){
				uni.login({
				  provider: 'weixin',
				  success: function (loginRes) {
				    console.log(loginRes);
					// 这里拿到了code 接下来要访问后台
					uni.request({
						url:"http://127.0.0.1:9009/api/wechat/login",
						data:{
							code:loginRes.code
						},
						success:(res)=> {
							console.log(res.data.data)
						}
					})
				  }
				});
			}
		}
	}
</script>

<style>

</style>
